Skip to main content
Version: Next 🚧

Long-Running Operations

This doc details what emitters will generate for long-running operations.

Resource create or replace​

Long-running operation to create or replace a resource.

alias ResourceOperations = global.Azure.Core.ResourceOperations<NoConditionalRequests &
NoRepeatableRequests &
NoClientRequestId>;

@resource("users")
@doc("Details about a user.")
model User {
@key
@visibility("read")
@doc("The name of user.")
name: string;

@doc("The role of user")
role: string;
}

// Operation for polling the status of the LRO. SDK may exclude this operation from client.
@sharedRoute
op getOperationStatus is ResourceOperations.GetResourceOperationStatus<User, never>;

@pollingOperation(getOperationStatus)
op createOrReplace is ResourceOperations.LongRunningResourceCreateOrReplace<User>;

Resource delete​

Long-running operation to delete a resource.

@pollingOperation(getOperationStatus)
op delete is ResourceOperations.LongRunningResourceDelete<User>;

Resource action​

Long-running operation to invoke an action on a resource.

@resource("users")
@doc("Details about a user.")
model User {
@key
@visibility("read")
@doc("The name of user.")
name: string;

@doc("The role of user")
role: string;
}

@doc("The parameters for exporting a user.")
model UserExportParams {
@query
@doc("The format of the data.")
format: string;
}

@doc("The exported user data.")
model ExportedUser {
@doc("The name of user.")
name: string;

@doc("The exported URI.")
resourceUri: string;
}

// Operation for polling the status of the LRO. SDK may exclude this operation from client.
@sharedRoute
op getExportOperationStatus is ResourceOperations.GetResourceOperationStatus<User, ExportedUser>;

@pollingOperation(getExportOperationStatus)
op export is ResourceOperations.LongRunningResourceAction<User, UserExportParams, ExportedUser>;